<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title></title>
    <meta name="renderer" content="webkit" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0" />
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all" />
</head>

<body>
    <div class="layui-fluid">
        <div class="layui-card">
            <div class="layui-form layui-card-header layuiadmin-card-header-auto">
                <div class="layui-form-item">
                    {:Lang('anchor_id')}:
                    <div class="layui-inline">
                        <input type="text" name="anchorid" placeholder="{:Lang('please_enter')}" autocomplete="off"
                            class="layui-input" />
                    </div>
                    {:Lang('live_category')}:
                    <div class="layui-inline">
                        <select name="categoryid">
                            <option value="">{:Lang('all')}</option>
                            {volist name="categorys" id="vo"}
                            <option value="{$vo.id}">{$vo.title}</option>
                            {/volist}
                        </select>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn layuiadmin-btn-livelist" lay-submit lay-filter="LAY-live-front-search">
                            <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                        </button>
                        <strong class="layui-btn layui-btn-primary"
                            style="cursor:default">{:Lang('total_ips_today')}:<span id="statisIpTotal">0</span></strong>
                        <strong class="layui-btn layui-btn-primary" style="cursor:default; color:white; background-color: #009688;" lay-on="iframe">今日观众总数:<span
                            id="statisViewerTotal">0</span></strong>
                    </div>
                </div>
            </div>

            <div class="layui-card-body">
                <table id="LAY-live-manage" lay-filter="LAY-live-manage"></table>
                <script type="text/html" id="toolbaar">
                <div class="layui-btn-container">
                    <button class="layui-btn layui-btn-danger layui-btn-sm" lay-event="mult_end_live">{:Lang('multiple_stop')}</button>
                </div>
            </script>
                <script type="text/html" id="table-livelist-live">
                {if $etype==0}
                <a class="layui-btn  layui-btn-xs" lay-event="edit">
                    <i class="layui-icon layui-icon-edit"></i>{:Lang('edit')}
                </a>
                <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="stop">
                    <i class="layui-icon layui-icon-delete"></i>{:Lang('stop')}
                </a>
                {/if}
                {{# if(d.activity_toggle == 0){ }}
                <a class="layui-btn  layui-btn-xs" lay-event="activity_open">
                    {:Lang('enable_activity')}
                </a>
                {{# } else { }}
                <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="activity_close">
                    {:Lang('disable_activity')}
                </a>
                {{# } }}
                <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="tag">
                    <i class="layui-icon layui-icon-edit"></i>{:Lang('tags_mod')}
                </a>
            </script>
            </div>
        </div>
    </div>

    <script src="/layuiadmin/layui/layui.2.7.6.js"></script>

    <script>
        var tags = <?php echo $tags;?>;
        var etype = {$etype};
        layui.config({
            base: "/layuiadmin/" //静态资源所在路径
            , version: "{:config('other.ui_version')}"
        }).extend({
            index: "lib/index", //主入口模块
        }).use(["index", "live", "table"], function () {
            var $ = layui.$,
                form = layui.form,
                table = layui.table,
                util = layui.util;

            //监听搜索
            form.on("submit(LAY-live-front-search)", function (data) {
                var field = data.field;

                //执行重载
                table.reload("LAY-live-manage", {
                    where: field
                    , page: {
                        curr: 1   //默认从第一页开始搜索
                    },
                });
            });

            // 批量事件
            util.on('lay-on', {
                iframe: function(){
                    // 页面层
                    layer.open({
                        type: 2,
                        title: '渠道信息统计',
                        shadeClose: true,
                        shade: 0.8,
                        area: ['800px', '600px'], // 宽高
                        content: '/admin/live/viewer_source_count',
                        success: function(layero, index, that){
                            // 获取 iframe 中 body 元素的 jQuery 对象
                            var body = layer.getChildFrame('body', index);
                            // 给 iframe 页中的某个输入框赋值
                            var sum = body.find('input').val();
                            layer.title(that.config.title+' (累计: '+ sum +')', event.data);
                        }
                    });
                },
            });
            
        });
    </script>
</body>

</html>